//
//  ByMyOrderVC.m
//  mijifen_ios
//
//  Created by 朱凯 on 2017/11/25.
//  Copyright © 2017年 itboye. All rights reserved.
//

#import "ByMyOrderVC.h"

// vc
#import "ByMyOrderSearchVC.h"

// view
#import "ByViewMyOrderListTable.h"

@interface ByMyOrderVC ()

@end

@implementation ByMyOrderVC

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = @"我的订单";
    
    [self addLeftBackBarButtonItem];
    [self addBYItemviews:@[@"搜索"] mode:ByNavigationItemModeImage position:ByNavigationItemPositionModeRight];
    
    [self createViews];
}

#pragma mark - 创建视图
- (void)createViews {
    
    ZKSegmentControl *segment = [[ZKSegmentControl alloc] init];
    segment.segmentsArray = @[@"  全部  ",
                              @" 待自取 ",
                              @" 待发货 ",
                              @" 待收货 ",
                              @" 已退款 ",
                              @" 已完成 ",
                              @" 待评价 "];
    segment.segmentTitleWidthDynamically = @YES;
    
    segment.segmentSelectTint = BY_GOLD_COLOR;
    segment.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:segment];
    [segment mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self.view);
        if (@available(ios 11.0,*)) {
            make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
        } else {
            make.bottom.equalTo(self);
        }
    }];
    
    
    segment.dynamicalAddContentViewBlock = ^ (void (^contentViewFetchBlock)(ZKSegmentContentView *contentView), NSInteger index) {
        
        ByViewMyOrderListTable *contentView = [[ByViewMyOrderListTable alloc] init];
        contentView.index = index;
        
        if (contentViewFetchBlock) {
            contentViewFetchBlock(contentView);
        }
    };
    
}

#pragma mark - 点击事件
- (void)rightItemsAction:(NSInteger)rightIndex {
    
    ByMyOrderSearchVC *vc = [ByMyOrderSearchVC new];
    [self by_normalPush:vc hasNavi:true];
}
@end
